import {
	baseUrl,
	httpRequest,
} from './api.js'

//字典数据
export const getDictItems = params => {
	return httpRequest({
		method: 'get',
		url: '/sys/dict/getDictItems/' + params,
	})
}

//微信登录 根据code获取openid
export const getOpenIdBywxCode = params => {
	return httpRequest({
		method: 'get',
		url: '/wx/code',
		data: params
	})
}

//微信小程序补充昵称头像信息
export const miniProgramUserAdd = params => {
	return httpRequest({
		method: 'post',
		url: '/mimi/miniProgramUser/applets_add_info',
		data: params
	})
}

//微信授权获取用户手机号
export const getUserPhone = params => {
	return httpRequest({
		method: 'get',
		url: '/wx/getUserPhone',
		data: params
	})
}

//微信登录 openid获取用户信息
export const miniProgramUserLogin = params => {
	return httpRequest({
		method: 'get',
		url: '/mimi/miniProgramUser/login',
		data: params
	})
}


//校验token过期状态
export const checkToken = params => {
	return httpRequest({
		method: 'get',
		url: '/sys/api/checkToken',
		data: params
	})
}

//获取首页轮播图
export const getBasicList = params => {
	return httpRequest({
		method: 'get',
		url: '/mini/open/basic/list',
		data: params
	})
}



//绑定角色
export const bingUser = params => {
	return httpRequest({
		method: 'post',
		url: '/mimi/miniProgramUser/bingUser',
		data: params
	})
}

//切换用户角色身份
export const changeRoleApi = params => {
	return httpRequest({
		method: 'get',
		url: '/mimi/miniProgramUser/changeRole',
		data: params
	})
}

//获取商品分类管理-商品分类查询
export const getCategoryList = params => {
	return httpRequest({
		method: 'get',
		url: '/wx/product/getCategoryList',
		data: params
	})
}

//获取商品列表
export const getGoodListApi = params => {
	return httpRequest({
		method: 'get',
		url: '/wx/product/list',
		data: params
	})
}
